package com.oocl.crm.pojo;

public class Customer 
{	
	private String id;
	private String name;
	private String sex;
	private String birthDate;
	private String address;
	private String phone;
	
	public Customer(String id, String name, String sex, 
			String birthDate, String address, String phone) {
		this.id = id;
		this.name = name;
		this.sex = sex;
		this.birthDate = birthDate;
		this.address = address;
		this.phone = phone;
	}
	public Customer(String id, String name, String sex) {
		this.id = id;
		this.name = name;
		this.sex = sex;
		this.birthDate = "";
		this.address = "";
		this.phone = "";
	}
	
	public boolean equals(Customer cust)
	{
		if(id.equals(cust.id))
			return true;
		else
			return false;
	}
	public int compareTo(Customer customer)
	{
		int a=Integer.parseInt(this.id);
		int b=Integer.parseInt(customer.id);
		if(a>b)
			return 1;
		else
			return -1;
	}
	public int compareName(Customer customer)
	{
		return name.compareTo(customer.name);
	}
	@Override
	public String toString() {
		return "Customer [id=" + id + ", name=" + name + ", sex=" + sex + ", birthDate=" + birthDate + ", address="
				+ address + ", phone=" + phone + "]";
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public String getBirthDate() {
		return birthDate;
	}
	public void setBirthDate(String birthDate) {
		this.birthDate = birthDate;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Customer other = (Customer) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	
	
}

